<?php
import($GLOBALS['spConfig']['controller_path'] . '/general.php');

/**
 * 管理员系统管理控制器
 * @author Fosf
 * @version 1.0
 * @created 2011-04-11
 */
class Main extends General
{
    var $user;
    public function __construct()
    {
        parent::__construct();
        $this->tpl_title = T("Dashboard");
        $this->navigation_current = 'main';
        $this->user = spClass('userModel')->userinfo();
    }
    function index()
    {
        $this->contents = "后台模块首页内容";
        $this->display("admin/main_index.html");
    }
    function left()
    {
        $user = $this->user;
        $fid = $this->spArgs('fid', 35);
        $leftlist = spClass('spAclModel')->getleftList($fid, $user['gid']);
        $this->leftlist = $leftlist;
        $this->display("admin/main_left.html");
    }
    function right()
    {
        
       // $GLOBALS['G_SP']['ext']['Imageabc'] = array(
//            	 'image_library' => 'gd2',
//        'source_image' => APP_PATH.'/upload/day_120921/banner-4.jpg',
//        'create_thumb' => TRUE,
//        'maintain_ratio' => TRUE,
//        'width' => 75,
//        'height' => 50,
//            );
//        //$this->load->library('image_lib', $config); 
//        $image=spClass('Image_lib');
//        echo $image->resize();
        $orderobj = spClass('orderModel');
        $customersobj = spClass('customersModel');
        $status = spClass('orders_statusModel')->findAll();
        foreach ($status as $k => $v) {
            $status[$k]['count'] = $orderobj->findCount('orders_status=' . $v['orders_status_id']);
        }
        $this->status = $status;
        $order_new = $orderobj->findAll(null, 'orders_id desc', null, 20);
        $this->order_new = $order_new;
        $customersall = $customersobj->findCount();
        $customers0 = $customersobj->findCount('no_customers=0');
        $customers1 = $customersobj->findCount('no_customers=1');
        $this->customersall = $customersall;
        $this->customers0 = $customers0;
        $this->customers1 = $customers1;
        $customers_new = $customersobj->findAll(null, 'customers_id desc', null, 10);
        $this->customers_new = $customers_new;
        $this->display("admin/main_right.html");
    }
    function top()
    {
        $this->u = $user = $this->user;
        $gid = $user['gid'];
        $toplist = spClass('spAclModel')->gettopList($gid);
        $this->toplist = $toplist;
        $this->display("admin/main_top.html");
    }
    function splitBar()
    {
        $this->display("admin/main_splitBar.html");
    }
    function jt()
    {
        $pic = $this->spArgs("pic", 0);
        $cropw = $this->spArgs("cropw");
        $croph = $this->spArgs("croph");
        $arr = getimagesize($pic);
        $this->cropw = $cropw;
        $this->croph = $croph;
        $this->pic = $pic;
        $this->width = $arr[0];
        $this->height = $arr[1];
        $this->display("admin/main_jt.html");
    }
}